rm update
[EroBeats.git] / Djinn and Tonic - Erobeats / Main.cpp
blob8cef2f9f08a236e8386e7e09460d68aa42743e63
1 #include<SDL/SDL.h>
3 #include "FileIO.h"
4 #include "ResourceMaster.h"
5 #include "SDLGraphics.h"
8 #include "Language.h"
9 #include "Menu.h"
10 #include "Settings.h"
11 #include "LevelSelect.h"
12 #include "MusicRoom.h"
14 #include "Trainer.h"
15 #include "ModeSelect.h"
16 #include "Level1.h"
17 #include "Level3.h"
18 #include "EndCard.h"
20 #include "ScreenNames.h"
22 //Go over changes and fix syntax errors
23 //Add zips
24 //Add beatmaps
25 //Test operations
26 //soft loss and hard end
29 SFX and BGM contain pointers to all the sound files and all the ways to work with sound
30 These have a password to the storage zips
31 ResourceMaster contains pointers and origonals for all resources in the game.
32 The renderer is created here
33 It holds the way to change screen size
34 FileIO takes stuff out of the storage zips to be located into the rescourcemaster.
35 It has a password to the storage zips
36 It handles saving and loading of all data
37 It has the complex and simple methods of fileIO for zip and raw
38 SDLGraphics sets up the window and starts loading things with the FileIO class.
39 Create load screen creates the load screen after loading all textures into memory
40 A new thread loads runs a bg image and the old thread loads the sound files.
41 The creation of the thread starts loading the sound files
42 Inside the main, integers and booleans manage the games life cycle
44 Language screen loads the languages with flags
45 Main Menu is the interface
46 Settigns holds settings
47 Music room holds animations and sounds
48 Quit dealocates everything.
52 int main(int argc, char** argv) {
54 SFX* sfxPtr = new SFX();
55 BGM* bgmPtr = new BGM();
56 ResourceMaster* resourcePointer = new ResourceMaster(sfxPtr, bgmPtr);
57 FileIO* fileIO = new FileIO(resourcePointer);
59 SDLGraphics* fullInit = new SDLGraphics(fileIO, resourcePointer);
60 fullInit->startThread();
61 fullInit->createLoadScreen();
63 int* screen = new int;
64 *screen = LanguageScreen;
65 int i = 0;
66 std::cout << "lol" << i + 1 << "\n";
67 bool runningMain = true;
68 while (runningMain) {
69 switch(*screen){
70 case LanguageScreen: {
71 Language lang(screen, fileIO, resourcePointer);
72 fileIO->loadAnimationsZipPast(30);
73 break;
75 case MainMenuScreen: {
76 Menu menu(screen, fileIO, resourcePointer);
77 break;
79 case SettingsScreen: {
80 Settings settings(screen, fileIO, resourcePointer);
81 break;
83 case MusicRoomScreen: {
84 MusicRoom musRoom(screen, fileIO, resourcePointer);
85 break;
87 case Quit: {
88 SDL_DestroyRenderer(resourcePointer->rendPtr);
89 SDL_DestroyWindow(resourcePointer->window);
90 delete resourcePointer;
91 delete sfxPtr;
92 delete bgmPtr;
93 delete fullInit;
94 delete screen;
95 delete fileIO;
97 runningMain = false;
98 break;
101 case LevelSelectScreen: {
102 LevelSelect lvlsel(screen, fileIO, resourcePointer);
103 break;
106 case Level1Screen: {
107 ModeSelect mode(screen, fileIO, resourcePointer);
108 if (!mode.getSkip()) {
109 int gameType = mode.getGameMode();
110 Level1 l1;
111 if (gameType == 1) {
113 else if (gameType == 2) {
116 EndCard ec(screen, 0, fileIO, resourcePointer, gameType, 1);
118 break;
120 case Level3Screen: {
121 ModeSelect mode(screen, fileIO, resourcePointer);
122 if (!mode.getSkip()) {
123 int gameType = mode.getGameMode();
124 Level3 l3(gameType, fileIO, resourcePointer, mode.getAnimations());
125 if (gameType == 1) {
126 int score = l3.getScore();
127 EndCard ec(screen, score, fileIO, resourcePointer, gameType, 3);
129 else if (gameType == 2) {
130 int hearts = l3.getHearts();
131 EndCard ec(screen, hearts, fileIO, resourcePointer, gameType, 3);
134 break;
138 return 0;